gh-155406: Fix struct.unpack_from documentation signature - #155408
gh-155406: Fix struct.unpack_from documentation signature#155408shoutoutuoadi325 wants to merge 1 commit into
Conversation
Remove the spurious '/' separator in the struct.unpack_from() signature documentation. The actual function signature is unpack_from(format, buffer, offset=0), not unpack_from(format, /, buffer, offset=0). This matches the actual function signature and the usage in test code.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 98337f0068
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
|
|
||
| .. function:: unpack_from(format, /, buffer, offset=0) | ||
| .. function:: unpack_from(format, buffer, offset=0) |
There was a problem hiding this comment.
Restore the positional-only marker for format
When callers follow this signature and pass format by keyword, struct.unpack_from(format='I', buffer=data) raises TypeError. The Argument Clinic declaration in Modules/_struct.c still places format before /, and the generated text signature remains unpack_from($module, format, /, buffer, offset=0), so removing this marker makes the documentation contradict the actual API.
Useful? React with 👍 / 👎.
Documentation build overview
|
Problem: The struct.unpack_from() documentation incorrectly shows a '/' separator in the signature.
Solution: Remove the spurious '/' separator. The correct signature is unpack_from(format, buffer, offset=0).
Changes: Modified Doc/library/struct.rst to fix the function signature.
Testing: This is a documentation-only change that matches the actual function signature and usage in test code.
Compatibility: No behavior changes, documentation correction only.